﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace NotMyBoom
{
    public abstract class VisibleGameEntity
    {
        protected List<My2DSprite> sprites;

        public List<My2DSprite> Sprites
        {
            get { return sprites; }
            set { sprites = value; }
        }
        protected int _nSprite;
        protected Vector2 _TopLeft;

        public Vector2 TopLeft
        {
            get { return _TopLeft; }
            set { _TopLeft = value; }
        }
        protected Vector2 _Size;

        public Vector2 Size
        {
            get { return _Size; }
            set { _Size = value; }
        }

        virtual public void Update(GameTime gameTime)
        {
            for (int i = 0; i < _nSprite; i++)
                sprites[i].Update(gameTime);
        }

        virtual public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            for (int i = 0; i < _nSprite; i++)
                sprites[i].Draw(gameTime, spriteBatch);
        }
        virtual public bool IsClicked(Vector2 point)
        {
            if ((point.X >= _TopLeft.X) &&
               (point.X <= _TopLeft.X + _Size.X) &&
               (point.Y >= _TopLeft.Y) &&
               (point.Y <= _TopLeft.Y + _Size.Y))
                return true;
            return false;
        }
    }
}
